package servlet.producttype;

import com.google.gson.Gson;
import dao.ProductTypeDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@WebServlet(name = "ProductCategoyServlet", value = "/ProductCategoyServlet.s")
public class ProductCategoyServlet extends HttpServlet {
    private ProductTypeDao dao = new ProductTypeDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String tname = request.getParameter("tname");
        String proname = request.getParameter("proname");

        List<Map<String, Object>> queryimage = dao.queryimage(tname,proname);

        String json = new Gson().toJson(queryimage);
        response.getWriter().print(json);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
